// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
use crate::Result;

/// Implements a [ConfigDelivery](super::stub::ConfigDelivery) decorator for logging and tracing.
#[derive(Clone, Debug)]
pub struct ConfigDelivery<T>
where
    T: super::stub::ConfigDelivery + std::fmt::Debug + Send + Sync,
{
    inner: T,
}

impl<T> ConfigDelivery<T>
where
    T: super::stub::ConfigDelivery + std::fmt::Debug + Send + Sync,
{
    pub fn new(inner: T) -> Self {
        Self { inner }
    }
}

impl<T> super::stub::ConfigDelivery for ConfigDelivery<T>
where
    T: super::stub::ConfigDelivery + std::fmt::Debug + Send + Sync,
{
    #[tracing::instrument(ret)]
    async fn list_resource_bundles(
        &self,
        req: crate::model::ListResourceBundlesRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListResourceBundlesResponse>> {
        self.inner.list_resource_bundles(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_resource_bundle(
        &self,
        req: crate::model::GetResourceBundleRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ResourceBundle>> {
        self.inner.get_resource_bundle(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_resource_bundle(
        &self,
        req: crate::model::CreateResourceBundleRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.create_resource_bundle(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_resource_bundle(
        &self,
        req: crate::model::UpdateResourceBundleRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.update_resource_bundle(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_resource_bundle(
        &self,
        req: crate::model::DeleteResourceBundleRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.delete_resource_bundle(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_fleet_packages(
        &self,
        req: crate::model::ListFleetPackagesRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListFleetPackagesResponse>> {
        self.inner.list_fleet_packages(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_fleet_package(
        &self,
        req: crate::model::GetFleetPackageRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::FleetPackage>> {
        self.inner.get_fleet_package(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_fleet_package(
        &self,
        req: crate::model::CreateFleetPackageRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.create_fleet_package(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_fleet_package(
        &self,
        req: crate::model::UpdateFleetPackageRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.update_fleet_package(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_fleet_package(
        &self,
        req: crate::model::DeleteFleetPackageRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.delete_fleet_package(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_releases(
        &self,
        req: crate::model::ListReleasesRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListReleasesResponse>> {
        self.inner.list_releases(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_release(
        &self,
        req: crate::model::GetReleaseRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Release>> {
        self.inner.get_release(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_release(
        &self,
        req: crate::model::CreateReleaseRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.create_release(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_release(
        &self,
        req: crate::model::UpdateReleaseRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.update_release(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_release(
        &self,
        req: crate::model::DeleteReleaseRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.delete_release(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_variants(
        &self,
        req: crate::model::ListVariantsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListVariantsResponse>> {
        self.inner.list_variants(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_variant(
        &self,
        req: crate::model::GetVariantRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Variant>> {
        self.inner.get_variant(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_variant(
        &self,
        req: crate::model::CreateVariantRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.create_variant(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_variant(
        &self,
        req: crate::model::UpdateVariantRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.update_variant(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_variant(
        &self,
        req: crate::model::DeleteVariantRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.delete_variant(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_rollouts(
        &self,
        req: crate::model::ListRolloutsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListRolloutsResponse>> {
        self.inner.list_rollouts(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_rollout(
        &self,
        req: crate::model::GetRolloutRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Rollout>> {
        self.inner.get_rollout(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn suspend_rollout(
        &self,
        req: crate::model::SuspendRolloutRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.suspend_rollout(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn resume_rollout(
        &self,
        req: crate::model::ResumeRolloutRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.resume_rollout(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn abort_rollout(
        &self,
        req: crate::model::AbortRolloutRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.abort_rollout(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_locations(
        &self,
        req: location::model::ListLocationsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<location::model::ListLocationsResponse>> {
        self.inner.list_locations(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_location(
        &self,
        req: location::model::GetLocationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<location::model::Location>> {
        self.inner.get_location(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_operations(
        &self,
        req: longrunning::model::ListOperationsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::ListOperationsResponse>> {
        self.inner.list_operations(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_operation(
        &self,
        req: longrunning::model::GetOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.get_operation(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_operation(
        &self,
        req: longrunning::model::DeleteOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.delete_operation(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn cancel_operation(
        &self,
        req: longrunning::model::CancelOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.cancel_operation(req, options).await
    }

    fn get_polling_error_policy(
        &self,
        options: &gax::options::RequestOptions,
    ) -> std::sync::Arc<dyn gax::polling_error_policy::PollingErrorPolicy> {
        self.inner.get_polling_error_policy(options)
    }

    fn get_polling_backoff_policy(
        &self,
        options: &gax::options::RequestOptions,
    ) -> std::sync::Arc<dyn gax::polling_backoff_policy::PollingBackoffPolicy> {
        self.inner.get_polling_backoff_policy(options)
    }
}
